//
//  WHSingleton.m
//  AddressBook
//
//  Created by  on 2020/7/29.
//  Copyright © 2020 wh. All rights reserved.
//

#import "WHSingleton.h"
#import <UIKit/UIKit.h>

@implementation WHSingleton

+ (instancetype)shareInstance
{
    static WHSingleton *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[WHSingleton alloc] init];
        instance.name = @"";
        instance.phone = @"";
        instance.address = @"";
        instance.imageStr = @"";
    });
    return instance;
}

+ (void)setDataWithIndex:(NSInteger)index content:(NSString *)content
{
    if (index == 0) {
        [WHSingleton shareInstance].name = content;
    }else if (index == 1){
        [WHSingleton shareInstance].phone = content;
    }else if (index == 2){
        [WHSingleton shareInstance].address = content;
    }else{
        [WHSingleton shareInstance].imageStr = content;
    }
}
+ (void)deleteAll
{
    [WHSingleton shareInstance].name = @"";
    [WHSingleton shareInstance].phone = @"";
    [WHSingleton shareInstance].address = @"";
    [WHSingleton shareInstance].imageStr = @"";
}

@end
